import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Layout/Home'
import Find from '@/views/Layout/Find'
import News from '@/views/Layout/News'
import My from '@/views/Layout/My'
import login from '@/views/Layout/login'
import city from '@/views/Layout/city'
import register from '@/views/Layout/register'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout/home'
  },
  {
    path: '/layout',
    component: Layout,
    // 子组件
    children: [
      {
        path: '/layout/home',
        component: Home
        // name: 'home'
      },
      {
        path: '/layout/find',
        component: Find
      }, {
        path: '/layout/news',
        component: News
      },
      {
        path: '/layout/register',
        component: register
      },
      {
        path: '/layout/login',
        component: login
      },
      {
        path: '/layout/my',
        component: My // // 子组件
      }
    ]
  },
  {
    path: '/city',
    component: city
  }

]

const router = new VueRouter({
  routes
})

export default router
